#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N = 410, MOD = 1e9 + 7;

LL n;
LL a[N][N * 2];

LL qpow(LL a, LL b, LL p)
{
	LL ans = 1;
	while(b)
	{
		if(b & 1) ans = ans * a % p;
		a = a * a % p;
		b >>= 1;
	}
	return ans;
}

int guass()
{
	for(int i = 1;i <= n;i ++)
	{
		int aim = i;
		for(int j = 1;j <= n;j ++)
		{
			if(j < i && a[j][j] != 0) continue;
			if(a[j][i] > a[aim][i]) aim = j;
		}
		if(a[aim][i] == 0) return 0;
		for(int j = 1;j <= 2 * n;j ++) swap(a[i][j], a[aim][j]);
		LL t = qpow(a[i][i], MOD - 2, MOD);
		for(int j = 2 * n;j >= i;j --) a[i][j] = a[i][j] * t % MOD;
		for(int j = 1;j <= n;j ++)
		{
			if(j == i) continue;
			t = a[j][i];
			for(int k = i;k <= 2 * n;k ++)
			{
				a[j][k] = a[j][k] - t * a[i][k] % MOD;
				a[j][k] = (a[j][k] % MOD + MOD) % MOD;
			}
		}
	}
	return 1;
}

int main()
{
	cin >> n;
	for(int i = 1;i <= n;i ++)
		for(int j = 1;j <= n;j ++)
			cin >> a[i][j];
	for(int i = 1;i <= n;i ++) a[i][i + n] = 1;
	int ans = guass();
	if(ans)
	{
		for(int i = 1;i <= n;i ++)
		{
			for(int j = n + 1;j <= 2 * n;j ++) cout << a[i][j] << " ";
			cout << endl;
		}
	}
	else cout << "No Solution" << endl;
	return 0;
}